import { createRequest } from '/@/api/service';
const module = 'ib/visitor/v1/ar/o';

/**
 * @function 查看访客登记详情-仅限访客
 * @param data
 * @param header
 * @returns {Promise}
 */
function QUERY_MY_DETAIL(
  data: VisitorAppointmentRecordApi.QueryMyDetailReq,
  header: object = {},
): Promise<VisitorAppointmentRecordApi.QueryMyDetailResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/md`, data, header, 'POST');
}

/**
 * @function 提交访客登记-仅限被邀请人
 * @param data
 * @param header
 * @returns {Promise}
 */
function INSERT(
  data: VisitorAppointmentRecordApi.InsertReq,
  header: object = {},
): Promise<VisitorAppointmentRecordApi.InsertResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/i`, data, header, 'POST');
}

/**
 * @function 查看访客登记详情-仅限被邀请人
 * @param data
 * @param header
 * @returns {Promise}
 */
function QUERY_DETAIL_BY_BATCH_NO(
  data: VisitorAppointmentRecordApi.QueryDetailByBatchNoReq,
  header: object = {},
): Promise<VisitorAppointmentRecordApi.QueryDetailByBatchNoResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/d`, data, header, 'POST');
}

/**
 * @function 查看访客登记详情-根据访客二维码
 * @param data
 * @param header
 * @returns {Promise}
 */
function GET_DETAIL_BY_QR_CODE(
  data: VisitorAppointmentRecordApi.GetDetailByQRcodeReq,
  header: object = {},
): Promise<VisitorAppointmentRecordApi.GetDetailByQRcodeResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/getDetailByQrcode`,
    data,
    header,
    'POST',
  );
}

export { QUERY_MY_DETAIL, INSERT, QUERY_DETAIL_BY_BATCH_NO, GET_DETAIL_BY_QR_CODE };
